{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "ff9104ca",
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "from general import *"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "79a48da8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "cba0dc4d0ae740d7a59d79963307e16c",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "0it [00:00, ?it/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "df_indus = pro.index_classify(level='L1', src='SW')\n",
    "num_indus = len(df_indus)\n",
    "\n",
    "dds = []\n",
    "for i,index_code in tqdm(enumerate(list(df_indus['index_code']))):\n",
    "    dd = pro.index_member(index_code=index_code)\n",
    "    dd['name'] = df_indus.loc[i,'industry_name']\n",
    "    dds.append(dd)\n",
    "\n",
    "df_indus_code = pd.concat(dds).reset_index(drop=True)\n",
    "df_indus_code['ts_code'] = df_indus_code['con_code']\n",
    "df_indus_code.index = df_indus_code['ts_code']\n",
    "code_indus_onehot = pd.get_dummies(df_indus_code['name'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "1d4bb3a0",
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "code_indus_onehot.to_csv('factors/industry_onehot.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "9544fc4a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>交通运输</th>\n",
       "      <th>休闲服务</th>\n",
       "      <th>传媒</th>\n",
       "      <th>公用事业</th>\n",
       "      <th>农林牧渔</th>\n",
       "      <th>化工</th>\n",
       "      <th>医药生物</th>\n",
       "      <th>商业贸易</th>\n",
       "      <th>国防军工</th>\n",
       "      <th>家用电器</th>\n",
       "      <th>...</th>\n",
       "      <th>纺织服装</th>\n",
       "      <th>综合</th>\n",
       "      <th>计算机</th>\n",
       "      <th>轻工制造</th>\n",
       "      <th>通信</th>\n",
       "      <th>采掘</th>\n",
       "      <th>钢铁</th>\n",
       "      <th>银行</th>\n",
       "      <th>非银金融</th>\n",
       "      <th>食品饮料</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ts_code</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>000552.SZ</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>000571.SZ</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>000629.SZ</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>000655.SZ</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>000723.SZ</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>600817.SH</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>600818.SH</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>603060.SH</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>603183.SH</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>605098.SH</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>4176 rows × 28 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "           交通运输  休闲服务  传媒  公用事业  农林牧渔  化工  医药生物  商业贸易  国防军工  家用电器  ...  纺织服装  \\\n",
       "ts_code                                                            ...         \n",
       "000552.SZ     0     0   0     0     0   0     0     0     0     0  ...     0   \n",
       "000571.SZ     0     0   0     0     0   0     0     0     0     0  ...     0   \n",
       "000629.SZ     0     0   0     0     0   0     0     0     0     0  ...     0   \n",
       "000655.SZ     0     0   0     0     0   0     0     0     0     0  ...     0   \n",
       "000723.SZ     0     0   0     0     0   0     0     0     0     0  ...     0   \n",
       "...         ...   ...  ..   ...   ...  ..   ...   ...   ...   ...  ...   ...   \n",
       "600817.SH     0     0   0     0     0   0     0     0     0     0  ...     0   \n",
       "600818.SH     0     0   0     0     0   0     0     0     0     0  ...     0   \n",
       "603060.SH     0     0   0     0     0   0     0     0     0     0  ...     0   \n",
       "603183.SH     0     0   0     0     0   0     0     0     0     0  ...     0   \n",
       "605098.SH     0     0   0     0     0   0     0     0     0     0  ...     0   \n",
       "\n",
       "           综合  计算机  轻工制造  通信  采掘  钢铁  银行  非银金融  食品饮料  \n",
       "ts_code                                               \n",
       "000552.SZ   0    0     0   0   1   0   0     0     0  \n",
       "000571.SZ   0    0     0   0   1   0   0     0     0  \n",
       "000629.SZ   0    0     0   0   1   0   0     0     0  \n",
       "000655.SZ   0    0     0   0   1   0   0     0     0  \n",
       "000723.SZ   0    0     0   0   1   0   0     0     0  \n",
       "...        ..  ...   ...  ..  ..  ..  ..   ...   ...  \n",
       "600817.SH   1    0     0   0   0   0   0     0     0  \n",
       "600818.SH   1    0     0   0   0   0   0     0     0  \n",
       "603060.SH   1    0     0   0   0   0   0     0     0  \n",
       "603183.SH   1    0     0   0   0   0   0     0     0  \n",
       "605098.SH   1    0     0   0   0   0   0     0     0  \n",
       "\n",
       "[4176 rows x 28 columns]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "code_indus_onehot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "1ad9bd26",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>ts_code</th>\n",
       "      <th>trade_date</th>\n",
       "      <th>name</th>\n",
       "      <th>open</th>\n",
       "      <th>low</th>\n",
       "      <th>high</th>\n",
       "      <th>close</th>\n",
       "      <th>change</th>\n",
       "      <th>pct_change</th>\n",
       "      <th>vol</th>\n",
       "      <th>amount</th>\n",
       "      <th>pe</th>\n",
       "      <th>pb</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>801230.SI</td>\n",
       "      <td>20211111</td>\n",
       "      <td>综合</td>\n",
       "      <td>2645.41</td>\n",
       "      <td>2639.92</td>\n",
       "      <td>2663.39</td>\n",
       "      <td>2646.34</td>\n",
       "      <td>-7.33</td>\n",
       "      <td>-0.28</td>\n",
       "      <td>38909.0</td>\n",
       "      <td>541743.0</td>\n",
       "      <td>49.98</td>\n",
       "      <td>2.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>801230.SI</td>\n",
       "      <td>20211110</td>\n",
       "      <td>综合</td>\n",
       "      <td>2670.91</td>\n",
       "      <td>2621.95</td>\n",
       "      <td>2670.96</td>\n",
       "      <td>2653.67</td>\n",
       "      <td>-41.88</td>\n",
       "      <td>-1.55</td>\n",
       "      <td>41366.0</td>\n",
       "      <td>616179.0</td>\n",
       "      <td>50.12</td>\n",
       "      <td>2.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>801230.SI</td>\n",
       "      <td>20211109</td>\n",
       "      <td>综合</td>\n",
       "      <td>2674.86</td>\n",
       "      <td>2659.37</td>\n",
       "      <td>2695.55</td>\n",
       "      <td>2695.55</td>\n",
       "      <td>38.91</td>\n",
       "      <td>1.46</td>\n",
       "      <td>43274.0</td>\n",
       "      <td>673123.0</td>\n",
       "      <td>50.91</td>\n",
       "      <td>2.53</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>801230.SI</td>\n",
       "      <td>20211108</td>\n",
       "      <td>综合</td>\n",
       "      <td>2603.66</td>\n",
       "      <td>2603.66</td>\n",
       "      <td>2663.70</td>\n",
       "      <td>2656.64</td>\n",
       "      <td>42.57</td>\n",
       "      <td>1.63</td>\n",
       "      <td>37861.0</td>\n",
       "      <td>573672.0</td>\n",
       "      <td>50.18</td>\n",
       "      <td>2.50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>801230.SI</td>\n",
       "      <td>20211105</td>\n",
       "      <td>综合</td>\n",
       "      <td>2647.87</td>\n",
       "      <td>2612.21</td>\n",
       "      <td>2656.90</td>\n",
       "      <td>2614.07</td>\n",
       "      <td>-37.79</td>\n",
       "      <td>-1.43</td>\n",
       "      <td>37093.0</td>\n",
       "      <td>552450.0</td>\n",
       "      <td>49.37</td>\n",
       "      <td>2.46</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>995</th>\n",
       "      <td>801230.SI</td>\n",
       "      <td>20171010</td>\n",
       "      <td>综合</td>\n",
       "      <td>3238.31</td>\n",
       "      <td>3235.92</td>\n",
       "      <td>3276.20</td>\n",
       "      <td>3276.12</td>\n",
       "      <td>66.81</td>\n",
       "      <td>2.08</td>\n",
       "      <td>54861.0</td>\n",
       "      <td>591691.0</td>\n",
       "      <td>51.91</td>\n",
       "      <td>2.87</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>996</th>\n",
       "      <td>801230.SI</td>\n",
       "      <td>20171009</td>\n",
       "      <td>综合</td>\n",
       "      <td>3240.04</td>\n",
       "      <td>3225.82</td>\n",
       "      <td>3247.76</td>\n",
       "      <td>3242.34</td>\n",
       "      <td>33.03</td>\n",
       "      <td>1.03</td>\n",
       "      <td>55580.0</td>\n",
       "      <td>607187.0</td>\n",
       "      <td>51.37</td>\n",
       "      <td>2.84</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>997</th>\n",
       "      <td>801230.SI</td>\n",
       "      <td>20170929</td>\n",
       "      <td>综合</td>\n",
       "      <td>3185.78</td>\n",
       "      <td>3183.70</td>\n",
       "      <td>3209.31</td>\n",
       "      <td>3209.31</td>\n",
       "      <td>26.68</td>\n",
       "      <td>0.84</td>\n",
       "      <td>44263.0</td>\n",
       "      <td>498564.0</td>\n",
       "      <td>50.86</td>\n",
       "      <td>2.81</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>998</th>\n",
       "      <td>801230.SI</td>\n",
       "      <td>20170928</td>\n",
       "      <td>综合</td>\n",
       "      <td>3199.54</td>\n",
       "      <td>3181.84</td>\n",
       "      <td>3221.99</td>\n",
       "      <td>3182.63</td>\n",
       "      <td>-19.89</td>\n",
       "      <td>-0.62</td>\n",
       "      <td>51577.0</td>\n",
       "      <td>589874.0</td>\n",
       "      <td>50.41</td>\n",
       "      <td>2.78</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>999</th>\n",
       "      <td>801230.SI</td>\n",
       "      <td>20170927</td>\n",
       "      <td>综合</td>\n",
       "      <td>3186.40</td>\n",
       "      <td>3184.98</td>\n",
       "      <td>3209.28</td>\n",
       "      <td>3202.51</td>\n",
       "      <td>20.84</td>\n",
       "      <td>0.65</td>\n",
       "      <td>46333.0</td>\n",
       "      <td>537847.0</td>\n",
       "      <td>50.57</td>\n",
       "      <td>2.79</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1000 rows × 13 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       ts_code trade_date name     open      low     high    close  change  \\\n",
       "0    801230.SI   20211111   综合  2645.41  2639.92  2663.39  2646.34   -7.33   \n",
       "1    801230.SI   20211110   综合  2670.91  2621.95  2670.96  2653.67  -41.88   \n",
       "2    801230.SI   20211109   综合  2674.86  2659.37  2695.55  2695.55   38.91   \n",
       "3    801230.SI   20211108   综合  2603.66  2603.66  2663.70  2656.64   42.57   \n",
       "4    801230.SI   20211105   综合  2647.87  2612.21  2656.90  2614.07  -37.79   \n",
       "..         ...        ...  ...      ...      ...      ...      ...     ...   \n",
       "995  801230.SI   20171010   综合  3238.31  3235.92  3276.20  3276.12   66.81   \n",
       "996  801230.SI   20171009   综合  3240.04  3225.82  3247.76  3242.34   33.03   \n",
       "997  801230.SI   20170929   综合  3185.78  3183.70  3209.31  3209.31   26.68   \n",
       "998  801230.SI   20170928   综合  3199.54  3181.84  3221.99  3182.63  -19.89   \n",
       "999  801230.SI   20170927   综合  3186.40  3184.98  3209.28  3202.51   20.84   \n",
       "\n",
       "     pct_change      vol    amount     pe    pb  \n",
       "0         -0.28  38909.0  541743.0  49.98  2.49  \n",
       "1         -1.55  41366.0  616179.0  50.12  2.49  \n",
       "2          1.46  43274.0  673123.0  50.91  2.53  \n",
       "3          1.63  37861.0  573672.0  50.18  2.50  \n",
       "4         -1.43  37093.0  552450.0  49.37  2.46  \n",
       "..          ...      ...       ...    ...   ...  \n",
       "995        2.08  54861.0  591691.0  51.91  2.87  \n",
       "996        1.03  55580.0  607187.0  51.37  2.84  \n",
       "997        0.84  44263.0  498564.0  50.86  2.81  \n",
       "998       -0.62  51577.0  589874.0  50.41  2.78  \n",
       "999        0.65  46333.0  537847.0  50.57  2.79  \n",
       "\n",
       "[1000 rows x 13 columns]"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pro.sw_daily(ts_code=index_code)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8ec60b63",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
